#include <glib.h>

static void _byte_array_print(GByteArray *barr, gconstpointer user_data)
{
    guint i = 0;
    g_print("%s", (gchar *)user_data);

    for(i=0; i<barr->len; i++) {
        g_print("%c ", barr->data[i]);
    }

    g_print("\n");
}

gint main(gint argc, gchar **argv)
{
    GByteArray *barr = NULL;

    barr = g_byte_array_new();

    g_byte_array_append(barr, (guint8 *)"Hello,World", strlen("Hello,World"));
    _byte_array_print(barr, "ori barr: ");

    g_byte_array_remove_index(barr, 5);
    _byte_array_print(barr, "remove_index(5) barr: ");

    g_byte_array_remove_index_fast(barr, 5);
    _byte_array_print(barr, "remove_index_fast(5) barr: ");

    g_byte_array_remove_range(barr, 5, 3);
    _byte_array_print(barr, "remove_range(5,3) barr: ");

    g_byte_array_free(barr, TRUE);

    return 0;
}